/**
 * <copyright>
 *
 * Copyright (c) 2011 Zeligsoft (2009) Limited
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: 
 *   Zeligsoft (2009) Limited - Initial API and implementation
 *
 * </copyright>
 *
 */
package org.omg.deployment.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;
import org.omg.deployment.DeploymentPackage;
import org.omg.deployment.Property;
import org.omg.deployment.ResourceDeploymentDescription;
import org.omg.xmi.impl.XMIImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Resource Deployment Description</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.omg.deployment.impl.ResourceDeploymentDescriptionImpl#getRequirementName <em>Requirement Name</em>}</li>
 *   <li>{@link org.omg.deployment.impl.ResourceDeploymentDescriptionImpl#getResourceName <em>Resource Name</em>}</li>
 *   <li>{@link org.omg.deployment.impl.ResourceDeploymentDescriptionImpl#getProperty <em>Property</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ResourceDeploymentDescriptionImpl extends XMIImpl implements
		ResourceDeploymentDescription {
	/**
	 * The default value of the '{@link #getRequirementName() <em>Requirement Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRequirementName()
	 * @generated
	 * @ordered
	 */
	protected static final String REQUIREMENT_NAME_EDEFAULT = null;

	/**
	 * The default value of the '{@link #getResourceName() <em>Resource Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getResourceName()
	 * @generated
	 * @ordered
	 */
	protected static final String RESOURCE_NAME_EDEFAULT = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ResourceDeploymentDescriptionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DeploymentPackage.eINSTANCE.getResourceDeploymentDescription();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getRequirementName() {
		return (String) getGroup()
				.get(DeploymentPackage.eINSTANCE
						.getResourceDeploymentDescription_RequirementName(),
						true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRequirementName(String newRequirementName) {
		((FeatureMap.Internal) getGroup()).set(DeploymentPackage.eINSTANCE
				.getResourceDeploymentDescription_RequirementName(),
				newRequirementName);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getResourceName() {
		return (String) getGroup()
				.get(DeploymentPackage.eINSTANCE
						.getResourceDeploymentDescription_ResourceName(),
						true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setResourceName(String newResourceName) {
		((FeatureMap.Internal) getGroup()).set(DeploymentPackage.eINSTANCE
				.getResourceDeploymentDescription_ResourceName(),
				newResourceName);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Property> getProperty() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE
						.getResourceDeploymentDescription_Property());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd,
			int featureID, NotificationChain msgs) {
		switch (featureID) {
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__PROPERTY:
			return ((InternalEList<?>) getProperty()).basicRemove(otherEnd,
					msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__REQUIREMENT_NAME:
			return getRequirementName();
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__RESOURCE_NAME:
			return getResourceName();
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__PROPERTY:
			return getProperty();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__REQUIREMENT_NAME:
			setRequirementName((String) newValue);
			return;
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__RESOURCE_NAME:
			setResourceName((String) newValue);
			return;
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__PROPERTY:
			getProperty().clear();
			getProperty().addAll((Collection<? extends Property>) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__REQUIREMENT_NAME:
			setRequirementName(REQUIREMENT_NAME_EDEFAULT);
			return;
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__RESOURCE_NAME:
			setResourceName(RESOURCE_NAME_EDEFAULT);
			return;
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__PROPERTY:
			getProperty().clear();
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__REQUIREMENT_NAME:
			return REQUIREMENT_NAME_EDEFAULT == null ? getRequirementName() != null
					: !REQUIREMENT_NAME_EDEFAULT.equals(getRequirementName());
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__RESOURCE_NAME:
			return RESOURCE_NAME_EDEFAULT == null ? getResourceName() != null
					: !RESOURCE_NAME_EDEFAULT.equals(getResourceName());
		case DeploymentPackage.RESOURCE_DEPLOYMENT_DESCRIPTION__PROPERTY:
			return !getProperty().isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //ResourceDeploymentDescriptionImpl
